// ========== 示例 ========== //
/** 计数状态 */
export type CountStateType = {
  count: number
}
/** 计数状态触发函数 */
export type CountStateActionType = {
  addCount: () => void
}

// ========== 语言 ========== //
/** 语言类型 */
export type LanguageType = 'zh-CN' | 'en-US'
/** 语言状态 */
export type LanguageStateType = {
  language: LanguageType
}
/** 语言状态触发函数 */
export type LanguageStateActionType = {
  setLanguage: (language: LanguageType) => void
  resetLanguage: () => void
}

// ========== 主题 ========== //
/** 主题类型 */
export type ThemeType = 'light' | 'dark' | 'red' | 'green' | 'blue' | 'gold' | 'default'
/** 主题状态 */
export type ThemeStateType = {
  theme: ThemeType
}
/** 主题状态触发函数 */
export type ThemeStateActionType = {
  setTheme: (theme: ThemeType) => void
  resetTheme: () => void
}

// ========== 元数据 ========== //
/** 元数据状态 */
export type MetaStateType = {
  meta: {
    title: string
    keywords: string
    description: string
  }
}
/** 元数据状态触发函数 */
export type MetaStateActionType = {
  setMeta: (title: string, keywords?: string, description?: string) => void
}

// ========== 菜单 ========== //
/** 菜单键状态 */
export type MenuStateType = {
  menuKey: string
}
/** 菜单键状态触发函数 */
export type MenuStateActionType = {
  setMenuKey: (menuKey: string) => void
}

// ========== 全局刷新 ========== //
export type RefreshStateType = {
  refreshModules: string[]
}
/** 全局刷新状态触发函数 */
export type RefreshStateActionType = {
  setRefresh: (refreshModules?: string[] | false | undefined) => void
}

// ========== 应用配置 ========== //
export type AppConfigStateType = {
  appConfig: {
    language: 'zh-CN' | 'en-US'
    theme: 'green' | 'blue' | 'purple' | 'pink'
    darkMode: boolean
    homeModules: Array<'todo' | 'note' | 'review'> // 首页展示的模块以及顺序
  }
}
/* 应用配置状态触发函数 */
export type AppConfigStateActionType = {
  setAppConfig: (appConfig: AppConfigStateType['appConfig']) => void
}

// ========== 权限配置 ========== //
export type UserAuthStateType = {
  userAuth: {
    authType: string
  }
}
/* 权限配置状态触发函数 */
export type UserAuthStateActionType = {
  setAuthConfig: (authConfig: UserAuthStateType) => void
}

// ========== 邮件类型配置 ========== //
export type MailTopTypeOptionType = {
  name: string
  value: string
  rule: string
}
export type MailSecondTypeOptionType = {
  extends: string
} & MailTopTypeOptionType

export type MailTypeOptionsStateType = {
  mailTopTypeOptions: Expand<MailTopTypeOptionType>[],
  mailSecondTypeOptions: Expand<MailSecondTypeOptionType>[]
}
/* 邮件类型配置状态触发函数 */
export type MailTypeOptionsStateActionType = {
  setMailTopTypeOptions: (mailTopTypeOptions: MailTopTypeOptionType[]) => void
  setMailSecondTypeOptions: (mailSecondTypeOptions: MailSecondTypeOptionType[]) => void
}

// ========== 邮件模板配置 ========== //
export type MailTemplateType = {
  topType: string,
  secondType: string,
  template: string
}
export type MailTemplatesStateType = {
  mailTemplates: Expand<MailTemplateType>[]
}
/* 邮件模板配置状态触发函数 */
export type MailTemplatesStateActionType = {
  setMailTemplates: (mailTemplates: MailTemplatesStateType['mailTemplates']) => void
}

// ========== cookies 配置 ========== //
export type CookiesStateType = {
  JSYCookie: string
}
/* cookies 配置状态触发函数 */
export type CookiesStateActionType = {
  setJSYCookie: (JSYCookie: string) => void
}

// ========== 日志 ========== //
export type LogStateType = {
  log: Array<{ type: 'info' | 'error' | 'success' | 'warning', log: string }>
}
/* 日志状态触发函数 */
export type LogStateActionType = {
  setLog: (a: LogStateType['log'], operation?: 'overwrite' | 'append') => Promise<void>
}